/**
 * 试题2
 *
 * @author lenovo
 * @version 1.0
 * @date 2023/6/10 10:23
 */

public class shiti {


    /**
     * 试题
     *
     @@ -77,8 +79,54 @@ public class Test01 {
     System.out.printf("i=%d,j=%d,a=%d,b=%d", i, j, a, b);
     }

     /**
      * 2: 定义一个5位整数 值随意 10000 99999  int i=52637;  打印各个位置上的数  个位值 i%10
     */
    private final static int TWO_MIN_VALUE = 10000;
    private final static int TWO_MAX_VALUE = 99999;

    public static void questionTwo(int num) {
        if (num < TWO_MIN_VALUE || num > TWO_MAX_VALUE) {
            throw new RuntimeException("对不起，请输入五位正整数！！！");
        }

        /**
         * 十进制用来求进制
         */
        int ten = 10;
        for (int i = num, j = 0; i > 0; i /= ten) {
            System.out.printf("%s位是%d\n", getPosition(j), num / (int) Math.pow(10, j++) % 10);
        }
    }

    /**
     * 根据 数字求位
     *
     * @param i
     * @return
     */
    private static String getPosition(int i) {
        switch (i) {
            case 0:
                return "个位";
            case 1:
                return "十位";
            case 2:
                return "百位";
            case 3:
                return "千位";
            case 4:
                return "万位";
            default:
                return "十万位";
        }
    }

    public static void main(String[] args) {
      int num=12345;
      int renum=0;
        for (int i = num,j=0; i >0; i/=10) {
            int t=num/(int)Math.pow(10,j++)%10;
        renum+=t;
        renum*=10;
        }
        System.out.println(renum);
    }

}

